import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import io.debezium.connector.informix.InformixConnector;
import io.debezium.engine.ChangeEvent;
import io.debezium.engine.DebeziumEngine;
import io.debezium.engine.format.Json;

public class informixDebezium {
    private static final Executor executor = Executors.newSingleThreadExecutor();

    public static void main(String[] args) {
        Properties props = new Properties();
        props.setProperty("name", "engine");
        props.setProperty("topic.prefix", "informixDebezium");
        props.setProperty("connector.class", InformixConnector.class.getName());
        props.setProperty("offset.storage", "org.apache.kafka.connect.storage.FileOffsetBackingStore");
        props.setProperty("offset.storage.file.filename", "D:\\tmp\\debezium\\gbase\\offsets.dat");
        props.setProperty("offset.flush.interval.ms", "60000");
        props.setProperty("database.hostname", "192.168.65.88");
        props.setProperty("database.port", "9088");
        props.setProperty("database.user", "gbasedbt");
        props.setProperty("database.password", "sync2023.");
        props.setProperty("database.dbname", "test");
        props.setProperty("table.include.list", "test.gbasedbt.test");
        props.setProperty("schema.history.internal", "io.debezium.storage.file.history.FileSchemaHistory");
        props.setProperty("schema.history.internal.file.filename", "D:\\tmp\\debezium\\gbase\\schemahistory.dat");
        props.setProperty("snapshot.mode", "always");

        try (DebeziumEngine<ChangeEvent<String, String>> engine = DebeziumEngine.create(Json.class)
                .using(props)
                .notifying(record -> {
                    System.out.println(record);
                }).build()) {
            ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.execute(engine);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }

}
